<?php
// +----------------------------------------------------------------------
// | Powered By ThinkPHP 5.0.12
// +----------------------------------------------------------------------
// | Copyright (c) 2018 http://www.bojuwang.net All rights reserved.
// +----------------------------------------------------------------------
// | Date：2018-1
// +----------------------------------------------------------------------
// | Author: ZhengLuwei <512711380@qq.com>
// +----------------------------------------------------------------------

namespace app\bjwlmanager\controller;

use think\Controller;
use think\Db;
use think\Request;

/**
 * 管理后台基本类，主要是用于权限控制
 */
class ManagerBasic extends Common
{
    
    private $managerId = '';
    private $managerName='';

    /**
     * 判断管理员是否登录
     */
    public function _initialize(){
        
        $request = Request::instance();
        $control= $request->controller();
        $action=$request->action();

        //echo $action;die;

        $this->view->assign('control',$control);
        $this->view->assign('action',$action);

        if(session('managerId') && session('managerName')){
            $this->managerId = session('managerId');
            $this->managerName = session('managerName');
            $managerInfo=Db::name('manager')->where('id',$this->managerId)->find();
            $this->assign('managerInfo',$managerInfo);
        }else{
            $this->redirect('Login/index');
        }
    }
}
